package duck.manager.impl;

import java.util.Iterator;
import java.util.List;

import pojo.Block;
import pojo.Myview;
import pojo.Persion;
import duck.dao.impl.CommonDaoImpl;
import duck.manager.SetSystem;

public class SetSystemImpl extends CommonDaoImpl implements SetSystem {

	public boolean addPersonBlock(Myview block) throws Exception {
		List users=super.loadAll("Persion");
		Iterator it=users.iterator();
		while(it.hasNext()){
			Persion p=(Persion)it.next();
			block.setPersion(p);
		}
		return super.save(block);
	}

	public boolean addPublicBlock(Block block) throws Exception {
		return super.save(block);
	}

	public List board(String type) throws Exception {
		return super.loadByQuery(type);
	}

	public boolean delete(String bid) throws Exception {
		return super.delete(super.load(Block.class, Integer.parseInt(bid)));
	}

	public boolean update(Block block) throws Exception {
		return super.update(block);
	}

	public Block viewSingle(String bid) throws Exception {
		return (Block)super.load(Block.class, Integer.parseInt(bid));
	}

}
